const Gtk = imports.gi.Gtk;
const Lang = imports.lang;

function
prog2 ()
{
  this._init ();
}

prog2.prototype =
{
_init:function ()
  {
	  /* create object */
    this._window = new Gtk.Window (
				   {
  title:			   "Prog2"});
    this._window.set_default_size (600, 600);
    this._darea = new Gtk.DrawingArea ();
    this._vbox = new Gtk.Box({orientation: Gtk.Orientation.VERTICAL, spacing:0});


	

    /* signal handle */
    this._window.connect ("hide", Gtk.main_quit);
    this._window.connect ("check-resize", Lang.bind (this, this._resizecb));
    this._darea.connect ("configure-event", Lang.bind (this, this._configureeventcb));
    this._darea.connect ("button-press-event", Lang.bind (this, this._onexposecb));
    this._darea.connect ("draw", Lang.bind (this, this._drawcb));

    /* connect object */
    this._vbox.pack_start (this._darea,true,true,0);
    this._window.add (this._vbox);
    this._window.show_all ();

},
_resizecb:function ()
  {
    let[_x, _y] = this._window.get_size ();
    print ("resize event\n");
	
	

  },
_configureeventcb:function ()
{
	let[_x, _y] = this._window.get_size ();
	_nx = _x /20;
	_ny = _y /20;
	print ("configure-event event\n");
},
_onexposecb:function (event)
{
	let [stageX, stageY]=event.get_coords();
	print (stageX);
	print (stageY);
	print ("button-press\n");
},
_drawcb:function ()
{
	print ("draw event\n");
}

}


Gtk.init (null, null);
var p2 = new prog2 ();
Gtk.main ();
